<style scoped>
  .marginTop{height: 24px;  line-height: 24px;}
  .marginBot{margin-bottom:10px;}
  .marginL{margin-left:5px!important;}
  .elRadio{margin-bottom: 10px;}
  .marginBot.abs{position: absolute;top:14px;left: 134px;}
  .demo-form-inline.pb0{padding-bottom: 0px;}
  .el-form-item__content .el-input {
    width: 168px;
  }
  .el-dialog__wrapper .el-form--inline .el-form-item__label{
    text-align: left;
  }
  /*打印预览样式*/
  .print-wrap{width:280px;height:65px;float:left;margin-right:20px;margin-bottom:10px;border:1px solid #ccc;}
  .print-top{height:50px;}
  .print-top .print-top-left{float:left;width:18px;height:50px;}
  .print-top .print-top-left .leFlagWrap{width:18px;height:18px;margin:5px 0px 3px 0px;}
  .print-top .print-top-left .leFlag{width:18px;height:18px;}
  .print-top .print-top-left .diffCode{padding-left:4px;width:12px;height:16px;display:block;font-size:16px;line-height:18px;}
  .print-top .barCode{float:left;border:0;width:260px;height:48px;}
  .print-bot .lenovoFlagWrap{float:left;border:0;width:50px;height:16px;margin-top:-5px;}
  .print-bot .lenovoFlag{width:50px;height:16px;}
  .print-bot .barCodeText{margin-top:-5px;width:220px;height:14px;float:left;font-size:12px;line-height:14px;text-align:right;color:#000;font-weight:900;}

</style>
<template>
  <div class="createBarCode">
    <el-tabs v-model="activeName2" type="card" @tab-click="handleClick">
        <!--联想技服条码-->
        <el-tab-pane :label="nowLangue.lenvoBarCode" name="first">
            <el-form :inline="true" :model="formInline" class="demo-form-inline" ref="formInline">
                <p>
                    <!--法人名称-->
                    <el-form-item :label="nowLangue.judgeName" class="selectMB10">
                        <el-input size="mini" v-model="formInline.legalPersonName" v-if="legalPersonDropDown.length == 1" disabled placeholder=""></el-input>
                        <el-select size="mini" clearable  v-model="formInline.legalPersonCode" v-else :placeholder="nowLangue.pleaseSelect" @change="changeLegalPerson">
                            <el-option v-for="(legalPerson,index) in legalPersonDropDown" :key="index" :label="legalPerson.legalPersonName" :value="legalPerson.legalPersonCode">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <!--操作人员-->
                    <el-form-item :label="nowLangue.operator" class="selectMB10">
                        <el-input size="mini" disabled v-model="formInline.personName"></el-input>
                    </el-form-item>
                    <!--操作日期-->
                    <el-form-item :label="nowLangue.operateDate" class="selectMB10">
                        <el-date-picker type="date" size="mini" :editable="false" v-model="formInline.operationTime" placeholder="选择日期"></el-date-picker>
                    </el-form-item>
                </p>
                <p>
                    <!--备件编码-->
                    <el-form-item :label="nowLangue.spareCode" class="selectMB10" prop="materialCode" :rules="[{ required: true, message: nowLangue.required}]">
                        <el-input size="mini" disabled v-model="formInline.materialCode"></el-input>
                        <el-button class="bolder outsideBtnBS marginL" size="mini" type="danger" @click="selectSpare">...</el-button>
                    </el-form-item>
                    <!--备件名称-->
                    <el-form-item :label="nowLangue.spareName" class="selectMB10">
                        <el-input size="mini" disabled v-model="formInline.materialName"></el-input>
                    </el-form-item>
                    <!--本次生成数量-->
                    <el-form-item :label="nowLangue.thisBuildNum" class="selectMB10" prop="createQuantity" :rules="[{ required: true, message: nowLangue.required}]">
                        <el-input size="mini" disabled v-model="formInline.createQuantity"></el-input>
                    </el-form-item>
                </p>
                <p>
                    <!--供应商条码-->
                    <el-form-item class="selectMB10" :label="nowLangue.supperBarCode" >
                        <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="scanIn" v-text="nowLangue.scan"><!--扫描--></el-button>
                        <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="importIn" v-text="nowLangue.importIn"><!--导入--></el-button>
                    </el-form-item>
                </p>
                <p>
                    <!--条码类型-->
                    <el-form-item :label="nowLangue.barCodeType" class="selectMB10" prop="snType" :rules="[{ required: true, message: nowLangue.pleaseSelect}]">
                        <el-select size="mini" :placeholder="nowLangue.pleaseSelect" clearable v-model="formInline.snType">
                            <el-option v-for="(snType,index) in snTypeData" :key="index" :label="snType.label" :value="snType.value"></el-option>
                        </el-select>
                    </el-form-item>
                    <!--区别码1-->
                    <el-form-item :label="nowLangue.diffCode1" class="selectMB10">
                        <el-select size="mini" :placeholder="nowLangue.pleaseSelect" clearable v-model="formInline.diffCode1">
                            <el-option v-for="(diffCode1,index) in diffCode1Data" :key="index" :label="diffCode1.label" :value="diffCode1.value"></el-option>
                        </el-select>
                    </el-form-item>
                    <!--区别码2-->
                    <el-form-item :label="nowLangue.diffCode2" class="selectMB10">
                        <el-select size="mini" :placeholder="nowLangue.pleaseSelect" clearable v-model="formInline.diffCode2">
                            <el-option v-for="(diffCode2,index) in diffCode2Data" :key="index" :label="diffCode2.label" :value="diffCode2.value"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item class="selectMB10">
                        <el-checkbox size="mini" class="marginTop" v-model="formInline.diffFlag" :label="nowLangue.printDifferCode"><!--打印区别码--></el-checkbox>
                    </el-form-item>
                </p>
                <p>
                    <!--条码打印地-->
                    <el-form-item :label="nowLangue.barCodePrintAddress" class="selectMB10" prop="region" :rules="[{ required: true, message: nowLangue.pleaseSelect}]">
                        <el-select size="mini" :placeholder="nowLangue.pleaseSelect" clearable v-model="formInline.region" @change="changeCodeSourceLenovo">
                            <el-option v-for="(codeSource,index) in codeSourceData" :key="index" :label="codeSource.label" :value="codeSource.value"></el-option>
                        </el-select>
                    </el-form-item>
                    <!--来源地区-->
                    <el-form-item :label="nowLangue.orignAddress" class="selectMB10" prop="sourceRegion" :rules="[{ required: true, message: nowLangue.pleaseSelect}]">
                        <el-select size="mini" :placeholder="nowLangue.pleaseSelect" clearable v-model="formInline.sourceRegion" @change="changeSourceRegionLenovo">
                            <el-option v-for="(sourceRegion,index) in sourceRegionData" :key="index" :label="sourceRegion.label" :value="sourceRegion.value"></el-option>
                        </el-select>
                    </el-form-item>
                    <!--来源方式-->
                    <el-form-item :label="nowLangue.orignWay" class="selectMB10" prop="sourceMode" :rules="[{ required: true, message: nowLangue.pleaseSelect}]">
                        <el-select size="mini" :placeholder="nowLangue.pleaseSelect" clearable disabled v-model="formInline.sourceMode" @change="changeSourceModeLenovo">
                            <el-option v-for="(sourceMode,index) in sourceModeData" :key="index" :label="sourceMode.label" :value="sourceMode.value"></el-option>
                        </el-select>
                    </el-form-item>
                </p>
                <p>
                    <!--打印方式-->
                    <el-form-item :label="nowLangue.printWay" class="selectMB10" prop="printMode" :rules="[{ required: true, message: nowLangue.pleaseSelect}]">
                        <el-select size="mini" :placeholder="nowLangue.pleaseSelect" clearable v-model="formInline.printMode">
                            <el-option v-for="(printMode,index) in printModeData" :key="index" :label="printMode.label" :value="printMode.value"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item class="selectMB10">
                        <el-checkbox size="mini" class="marginTop" v-model="formInline.lenovoFlag" :label="nowLangue.printLenvo"><!--打印Lenovo标记--></el-checkbox>
                    </el-form-item>
                    <!--选择打印机-->
                    <el-form-item :label="nowLangue.selectPrint" class="selectMB10" prop="printerType" :rules="[{ required: true, message: nowLangue.pleaseSelect}]">
                        <el-select size="mini" :placeholder="nowLangue.pleaseSelect" clearable v-model="formInline.printerType" @change="changeLenovoType">
                            <el-option v-for="(printerType,index) in available_printers" :key="index" :label="printerType.name" :value="printerType.uid"></el-option>
                        </el-select>
                    </el-form-item>
                </p>
                <el-form-item class="selectMB10">
                    <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="createNew" v-text="nowLangue.create"><!--生成--></el-button>
                    <el-button class="bolder outsideBtnBS" :disabled="spareJiFuDataAll.length==0" size="mini" type="danger" @click="createNew" v-text="nowLangue.createAgain"><!--重新生成--></el-button>
                    <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="printLenovoPreview" v-text="nowLangue.printPreview"><!--打印预览--></el-button>
                    <el-button class="bolder outsideBtnBS" size="mini" type="danger" :disabled="printLenovoDisabled" @click="printLenovoBarCode" v-text="nowLangue.print"><!--打印--></el-button>
                    <el-button class="bolder outsideBtnBS" size="mini" type="danger" :disabled="printLenovoDisabled" @click="createPrintLenovo" v-text="nowLangue.createAndPrint"><!--生成并打印--></el-button>
                </el-form-item>
            </el-form>
            <!--备件技服条码列表-->
            <div>
                <label class="default-label" v-text="nowLangue.spareBarCodeList"><!--备件技服条码列表--></label>
            </div>
            <el-table :data="spareJiFuData" border style="width:100%;width: 100%;">
                <!--序-->
                <el-table-column type="index" header-align="center" align="center" :label="nowLangue.xu" width="40" show-overflow-tooltip></el-table-column>
                <!--备件编码-->
                <el-table-column prop="materialCode" :label="nowLangue.spareCode" header-align="center" show-overflow-tooltip></el-table-column>
                <!--备件名称-->
                <el-table-column prop="materialName" :label="nowLangue.spareName" header-align="center" show-overflow-tooltip></el-table-column>
                <!--联想技服条码-->
                <el-table-column prop="lenovoBarCode" :label="nowLangue.lenvoBarCode" header-align="center" show-overflow-tooltip></el-table-column>
                <!--SN（或商品条码）-->
                <el-table-column prop="SNcode" :label="nowLangue.SNcode" header-align="center" min-width="130" show-overflow-tooltip></el-table-column>
                <!--区别码1-->
                <el-table-column prop="diffCode1" :label="nowLangue.diffCode1" header-align="center" show-overflow-tooltip></el-table-column>
                <!--区别码2-->
                <el-table-column prop="diffCode2" :label="nowLangue.diffCode2" header-align="center" show-overflow-tooltip></el-table-column>
                <!--条码打印地-->
                <el-table-column prop="barCodePrintAddress" :label="nowLangue.barCodePrintAddress" header-align="center" show-overflow-tooltip></el-table-column>
                <!--来源地区-->
                <el-table-column prop="orignAddress" :label="nowLangue.orignAddress" header-align="center" show-overflow-tooltip></el-table-column>
                <!--来源方式-->
                <el-table-column prop="orignWay" :label="nowLangue.orignWay" header-align="center" show-overflow-tooltip></el-table-column>
                <!--生成时间-->
                <el-table-column prop="operationTime" :label="nowLangue.createTime" header-align="center" show-overflow-tooltip></el-table-column>
                <!--操作人-->
                <el-table-column prop="personName" :label="nowLangue.operator" header-align="center" show-overflow-tooltip></el-table-column>
            </el-table>
            <!--分页-->
            <el-pagination v-if="isPaging" @size-change="handleSizeChange" @current-change="handleCurrentChange"  :current-page.sync="currentPage" :current-page="pageIndex"  :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :page-count="totalPage" :total="totalNumber"></el-pagination>
        </el-tab-pane>
        <!--供应商条码-->
        <el-tab-pane :label="nowLangue.supperBarCode" name="second">
        <el-form :inline="true" :model="formInlineSupplier" class="demo-form-inline" ref="formInlineSupplier">
            <p>
                <!--法人名称-->
                <el-form-item :label="nowLangue.judgeName" class="selectMB10">
                    <el-input size="mini" v-model="formInlineSupplier.legalPersonName" v-if="legalPersonDropDown.length == 1" disabled placeholder=""></el-input>
                    <el-select size="mini" clearable  v-model="formInlineSupplier.legalPersonCode" v-else :placeholder="nowLangue.pleaseSelect" @change="changeLegalPersonSupplier">
                        <el-option v-for="(legalPerson,index) in legalPersonDropDown" :key="index" :label="legalPerson.legalPersonName" :value="legalPerson.legalPersonCode">
                        </el-option>
                    </el-select>
                </el-form-item>
                <!--操作人员-->
                <el-form-item :label="nowLangue.operator" class="selectMB10">
                    <el-input disabled size="mini" v-model="formInlineSupplier.personName"></el-input>
                </el-form-item>
                <!--操作日期-->
                <el-form-item :label="nowLangue.operateDate" class="selectMB10">
                    <el-date-picker type="date" size="mini" :editable="false" v-model="formInlineSupplier.operationTime" placeholder="选择日期"></el-date-picker>
                </el-form-item>
            </p>
            <p>
                <!--备件编码-->
                <el-form-item :label="nowLangue.spareCode" class="selectMB10" prop="materialCode" :rules="[{ required: true, message: nowLangue.required}]">
                  <el-input size="mini" disabled v-model="formInlineSupplier.materialCode"></el-input>
                  <el-button class="bolder outsideBtnBS marginL" size="mini" type="danger" @click="selectSpareSupplier">...</el-button>
                </el-form-item>
                <!--备件名称-->
                <el-form-item :label="nowLangue.spareName" class="selectMB10">
                  <el-input size="mini" disabled v-model="formInlineSupplier.materialName"></el-input>
                </el-form-item>
            </p>
            <p>
                <!--条码类别-->
                <el-form-item :label="nowLangue.barCodeClass" class="selectMB10" prop="dataType" :rules="[{ required: true, message: nowLangue.pleaseSelect}]">
                  <el-select size="mini" :placeholder="nowLangue.pleaseSelect" clearable v-model="formInlineSupplier.dataType">
                    <!--<el-option :label="nowLangue.supperBarCode" :value="nowLangue.supperBarCode"></el-option>-->
                      <el-option v-for="(barCodeType,index) in barCodeTypeData" :key="index" :label="barCodeType.label" :value="barCodeType.value"></el-option>
                  </el-select>
                </el-form-item>
                <!--商品条码-->
                <!--<el-form-item class="selectMB10" :label="nowLangue.goodsBarCode"  v-else>-->
                <!--<el-input size="mini" v-model="formInlineSupplier.platformCode"></el-input>-->
                <!--</el-form-item>-->
                <!--本次生成数量-->
                <el-form-item :label="nowLangue.thisBuildNum" class="selectMB10" prop="createQuantity" :rules="[{ required: true, message: nowLangue.required}]">
                    <el-input size="mini" :disabled="formInlineSupplier.dataType==1" v-model="formInlineSupplier.createQuantity"></el-input>
                </el-form-item>
                <el-form-item class="selectMB10"><!--v-if="formInlineSupplier.dataType"-->
                  <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="scanInSupplier" v-text="nowLangue.scan"><!--扫描--></el-button>
                  <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="importInSupplier" v-text="nowLangue.importIn"><!--导入--></el-button>
                </el-form-item>
            </p>
            <p>
                <!--条码打印地-->
                <el-form-item :label="nowLangue.barCodePrintAddress" class="selectMB10" prop="region" :rules="[{ required: true, message: nowLangue.pleaseSelect}]">
                    <el-select size="mini" :placeholder="nowLangue.pleaseSelect" clearable v-model="formInlineSupplier.region" @change="changeCodeSourceSupplier">
                        <el-option v-for="(codeSource,index) in codeSourceData" :key="index" :label="codeSource.label" :value="codeSource.value"></el-option>
                    </el-select>
                </el-form-item>
                <!--来源地区-->
                <el-form-item :label="nowLangue.orignAddress" class="selectMB10" prop="sourceRegion" :rules="[{ required: true, message: nowLangue.pleaseSelect}]">
                    <el-select size="mini" :placeholder="nowLangue.pleaseSelect" clearable v-model="formInlineSupplier.sourceRegion" @change="changeSourceRegionSupplier">
                        <el-option v-for="(sourceRegion,index) in sourceRegionData" :key="index" :label="sourceRegion.label" :value="sourceRegion.value"></el-option>
                    </el-select>
                </el-form-item>
                <!--来源方式-->
                <el-form-item :label="nowLangue.orignWay" class="selectMB10" prop="sourceMode" :rules="[{ required: true, message: nowLangue.pleaseSelect}]">
                    <el-select size="mini" :placeholder="nowLangue.pleaseSelect" clearable disabled v-model="formInlineSupplier.sourceMode" @change="changeSourceModeSupplier">
                        <el-option v-for="(sourceMode,index) in sourceModeData" :key="index" :label="sourceMode.label" :value="sourceMode.value"></el-option>
                    </el-select>
                </el-form-item>
            </p>
            <p>
                <!--打印方式-->
                <el-form-item :label="nowLangue.printWay" class="selectMB10" prop="printMode" :rules="[{ required: true, message: nowLangue.pleaseSelect}]">
                    <el-select size="mini" :placeholder="nowLangue.pleaseSelect" clearable v-model="formInlineSupplier.printMode">
                        <el-option v-for="(printMode,index) in printModeData" :key="index" :label="printMode.label" :value="printMode.value"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item class="selectMB10">
                    <el-checkbox size="mini" class="marginTop" v-model="formInlineSupplier.lenovoFlag" :label="nowLangue.printLenvo"><!--打印Lenovo标记--></el-checkbox>
                </el-form-item>
                <!--选择打印机-->
                <el-form-item :label="nowLangue.selectPrint" class="selectMB10" prop="printerType" :rules="[{ required: true, message: nowLangue.pleaseSelect}]">
                    <el-select size="mini" :placeholder="nowLangue.pleaseSelect" clearable v-model="formInlineSupplier.printerType">
                        <el-option v-for="(printerType,index) in available_printers" :key="index" :label="printerType.name" :value="printerType.uid"></el-option>
                    </el-select>
                </el-form-item>
            </p>
            <el-form-item class="selectMB10">
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="createSupplier" v-text="nowLangue.create"><!--生成--></el-button>
                <el-button class="bolder outsideBtnBS" :disabled="spareSupplierData.length==0" @click="createSupplier" size="mini" type="danger" v-text="nowLangue.createAgain"><!--重新生成--></el-button>
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="printSupplierPreview" v-text="nowLangue.printPreview"><!--打印预览--></el-button>
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" :disabled="printSupplierDisabled" @click="printSupplierBarCode" v-text="nowLangue.print"><!--打印--></el-button>
                <el-button class="bolder outsideBtnBS" size="mini" type="danger" :disabled="printSupplierDisabled" @click="createPrintSupplier" v-text="nowLangue.createAndPrint"><!--生成并打印--></el-button>
            </el-form-item>
        </el-form>
        <!--备件技服条码列表-->
        <div>
          <label class="default-label" v-text="nowLangue.spareSupperCodeList"><!--备件供应商条码列表--></label>
        </div>
        <el-table :data="spareSupplierData" border style="width:100%;width: 100%;">
            <!--序-->
            <el-table-column type="index" header-align="center" align="center" :label="nowLangue.xu" width="40" show-overflow-tooltip></el-table-column>
            <!--备件编码-->
            <el-table-column prop="materialCode" :label="nowLangue.spareCode" header-align="center" show-overflow-tooltip></el-table-column>
            <!--备件名称-->
            <el-table-column prop="materialName" :label="nowLangue.spareName" header-align="center" show-overflow-tooltip></el-table-column>
            <!--SN（或商品条码）-->
            <el-table-column prop="SNcode" :label="nowLangue.SNcode" header-align="center" min-width="130" show-overflow-tooltip></el-table-column>
            <!--条码类型-->
            <el-table-column prop="dataType" :label="nowLangue.barCodeType" header-align="center" show-overflow-tooltip></el-table-column>
            <!--条码打印地-->
            <el-table-column prop="barCodePrintAddress" :label="nowLangue.barCodePrintAddress" header-align="center" show-overflow-tooltip></el-table-column>
            <!--来源地区-->
            <el-table-column prop="orignAddress" :label="nowLangue.orignAddress" header-align="center" show-overflow-tooltip></el-table-column>
            <!--来源方式-->
            <el-table-column prop="orignWay" :label="nowLangue.orignWay" header-align="center" show-overflow-tooltip></el-table-column>
            <!--生成时间-->
            <el-table-column prop="operationTime" :label="nowLangue.createTime" header-align="center" show-overflow-tooltip></el-table-column>
            <!--操作人-->
            <el-table-column prop="personName" :label="nowLangue.operator" header-align="center" show-overflow-tooltip></el-table-column>
        </el-table>
        <!--分页-->
        <el-pagination v-if="isPaging3" @size-change="handleSizeChange3" @current-change="handleCurrentChange3"  :current-page.sync="currentPage3" :current-page="pageIndex3"  :page-size="pageSize3" layout="total, sizes, prev, pager, next, jumper" :page-count="totalPage3" :total="totalNumber3"></el-pagination>

        </el-tab-pane>
    </el-tabs>
    <!--联想技服 选择备件编码弹窗-->
    <el-dialog :visible.sync="dialogForm1Visible" size="large" @close="handleCloseLevono">
      <el-radio-group v-model="selectType" class="elRadio" @change="queryByType">
        <el-radio :label="false" v-cloak><!--按实际收货数量打印-->{{nowLangue.printByReal}}</el-radio>
        <el-radio :label="true" v-cloak><!--按ASN数量打印-->{{nowLangue.printByASN}}</el-radio>
      </el-radio-group>
      <el-form :inline="true" :model="printedSpare" class="demo-form-inline">
        <!--ASN编号-->
        <el-form-item :label="nowLangue.ASNcode" class="selectMB10">
          <el-input  v-model="printedSpare.asnCode" :placeholder="nowLangue.pleaseImport+nowLangue.ASNcode"></el-input>
        </el-form-item>
        <!--PO编号-->
        <el-form-item :label="nowLangue.POcode" class="selectMB10">
          <el-input  v-model="printedSpare.orderCode" :placeholder="nowLangue.pleaseImport+nowLangue.POcode"></el-input>
        </el-form-item>
        <!--订单类型-->
        <el-form-item :label="nowLangue.orderType" class="selectMB10">
          <el-select size="mini" :placeholder="nowLangue.pleaseSelect" clearable v-model="printedSpare.orderType">
              <el-option v-for="(sourceMode,index) in sourceModeData" :key="index" :label="sourceMode.label" :value="sourceMode.value"></el-option>
          </el-select>
        </el-form-item>
        <!--供应商编号-->
        <el-form-item :label="nowLangue.supperCode" class="selectMB10">
          <el-input  v-model="printedSpare.supplierCode" :placeholder="nowLangue.pleaseImport+nowLangue.supperCode"></el-input>
        </el-form-item>
        <!--供应商名称-->
        <el-form-item :label="nowLangue.supperName" class="selectMB10">
          <el-input  v-model="printedSpare.supplierName" :placeholder="nowLangue.pleaseImport+nowLangue.supperName"></el-input>
        </el-form-item>
        <el-form-item class="selectMB10">
          <el-button class="bolder outsideBtnBS selectAll" :disabled="selectDisabled" size="mini" @click="queryByType" type="danger" v-text="nowLangue.query"><!--查询--></el-button>
        </el-form-item>
        <el-form-item class="selectMB10">
          <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="confirmLenovoSpare" v-text="nowLangue.confirm"><!--确定--></el-button>
        </el-form-item>
      </el-form>
      <div>
        <label class="default-label" v-text="nowLangue.loadPrintList"><!--待打印备件条码列表--></label>
      </div>
      <el-table :data="loadPrintLenovoData" border style="width: 100%" v-loading.body="loading2">
        <!--序-->
        <el-table-column type="index" header-align="center" align="center" :label="nowLangue.xu" width="40" show-overflow-tooltip></el-table-column>
        <!--选择-->
        <el-table-column  :label="nowLangue.sel" header-align="center" align="center" width="40">
            <template scope="scope">
                <el-radio v-model="defaultLoadPrintLenovo" :label="scope.row" size="mini">&nbsp;</el-radio>
            </template>
        </el-table-column>
        <!--备件编码-->
        <el-table-column prop="materialCode" :label="nowLangue.spareCode" header-align="center" show-overflow-tooltip></el-table-column>
        <!--备件名称-->
        <el-table-column prop="materialName" :label="nowLangue.spareName" header-align="center" show-overflow-tooltip></el-table-column>
        <!--计量单位-->
        <el-table-column prop="unit" :label="nowLangue.measureUnit" header-align="center" show-overflow-tooltip></el-table-column>
        <!--收货单编号-->
        <el-table-column prop="receiptNo" v-if="!selectType" :label="nowLangue.receiptNo" header-align="center" show-overflow-tooltip></el-table-column>
        <!--ASN数量-->
        <el-table-column prop="asnQuantity" :label="nowLangue.ASNnum" header-align="center" show-overflow-tooltip></el-table-column>
        <!--收货数量-->
        <el-table-column prop="receiptQuantity" v-if="!selectType" :label="nowLangue.receiveGoodsNum" header-align="center" show-overflow-tooltip></el-table-column>
        <!--本次生成数量-->
        <!--<el-table-column prop="thisProduceQuantity" :label="nowLangue.thisBuildNum" header-align="center" show-overflow-tooltip></el-table-column>-->
        <!--需要填写的一列 --本次生成数量-->
        <el-table-column prop="thisProduceQuantity" :label="nowLangue.thisBuildNum" header-align="center" width="100">
            <template scope="scope">
              <el-input size="mini" v-model.number="scope.row.thisProduceQuantity" @change="inputQuantity(scope.$index, scope.row)"></el-input>
            </template>
        </el-table-column>
        <!--ASN编号-->
        <el-table-column prop="asnCode" :label="nowLangue.ASNcode" header-align="center" show-overflow-tooltip></el-table-column>
        <!--PO编号-->
        <el-table-column prop="orderCode" :label="nowLangue.POcode" header-align="center" show-overflow-tooltip></el-table-column>
        <!--供应商编码-->
        <el-table-column prop="supplierCode" :label="nowLangue.supperCode" header-align="center" show-overflow-tooltip></el-table-column>
        <!--供应商名称-->
        <el-table-column prop="supplierName" :label="nowLangue.supperName" header-align="center" show-overflow-tooltip></el-table-column>
        <!--已生成数量-->
        <el-table-column prop="produceQuantity" :label="nowLangue.generatedNum" header-align="center" show-overflow-tooltip></el-table-column>
        <!--未生成数量-->
        <el-table-column prop="noProduceQuantity" :label="nowLangue.notGeneratedNum" header-align="center" show-overflow-tooltip></el-table-column>
      </el-table>
      <!--分页-->
        <el-pagination v-if="isPaging2" @size-change="handleSizeChange2" @current-change="handleCurrentChange2"  :current-page.sync="currentPage2" :current-page="pageIndex2"  :page-size="pageSize2" layout="total, sizes, prev, pager, next, jumper" :page-count="totalPage2" :total="totalNumber2"></el-pagination>
    </el-dialog>
    <!--联想技服 供应商条码导入弹窗-->
    <el-dialog :title="nowLangue.exportTitle" id="LeadIngInMark" :visible.sync="importDialog" size="tiny"  :lock-scroll=false>
      <el-upload class="upload-demo" :action="action"  :on-preview="handlePreview" :on-remove="handleRemove" :file-list="fileList" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload" :data="{materialCode:formInline.materialCode}">
        <el-button size="mini" type="danger" v-text="nowLangue.choseExport"></el-button>
        <div slot="tip" class="el-upload__tip" v-text="nowLangue.choseExportTip"></div>
      </el-upload>
    </el-dialog>
    <!--联想技服 供应商条码扫描弹窗-->
    <el-dialog :title="nowLangue.scanTitle" :visible.sync="scanVisible">
      <div class="marginBot abs">
        <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="confirmScan" v-text="nowLangue.confirm"><!--确定--></el-button>
        <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="returnClear" v-text="nowLangue.returnAdd"><!--返加--></el-button>
      </div>
      <el-form :inline="true"  class="demo-form-inline pb0">
        <!--扫描条码信息-->
        <el-form-item class="selectMB0" :label="nowLangue.scanBarcodeInfor">
          <el-input class="marginBot" size="mini" v-model="scanBarCodeLenovo" @keyup.enter.native="scanInTable($event)"></el-input>
        </el-form-item>
      </el-form>
      <el-table :data="scanBarCodeLenovoData" border style="width: 100%" v-loading.body="loading2">
        <!--序-->
        <el-table-column type="index" header-align="center" align="center" :label="nowLangue.xu" width="40" show-overflow-tooltip></el-table-column>
        <!--备件SN-->
        <el-table-column prop="spareSN" :label="nowLangue.spareSN" header-align="center" show-overflow-tooltip></el-table-column>
      </el-table>
    </el-dialog>
    <!--联想技服 打印预览弹窗-->
    <el-dialog :title="nowLangue.printLenovoPreview" size="tiny" :visible.sync="dialogLenovoPreviewVisible" @close="handleCloseLenovoPreview">
        <div v-for="(barcode,index) in snCodeList" :key="index">
            <!--根据包装方式循环-->
            <div v-for="(type,num) in printModeFor" :key="num" class="print-wrap clearfix">
                <div class="print-top clearfix">
                    <!--箱标和区别码-->
                    <div class="print-top-left">
                        <div class="leFlagWrap">
                            <img class="leFlag" v-if="(type==1 && formInline.printMode==2) || type==2 || type==3" src="../../../images/le.png" alt="">
                        </div>
                        <span class="diffCode" v-if="formInline.diffFlag" v-text="formInline.diffCode1"></span>
                    </div>
                    <!--条码-->
                    <img class="barCode" :src="imgList[index]"/>
                </div>
                <div class="print-bot clearfix">
                    <!--lenovo标-->
                    <div class="lenovoFlagWrap">
                        <img v-if="formInline.lenovoFlag" class="lenovoFlag" src="../../../images/logo.png" alt="">
                    </div>
                    <!--条码内容-->
                    <p class="barCodeText" v-text="barcode"></p>
                </div>
            </div>
        </div>
      </el-dialog>
    <!--供应商 选择备件编码弹窗-->
    <el-dialog :visible.sync="dialogForm2Visible" size="large" @close="handleCloseSupplier">
      <el-radio-group v-model="selectType2" class="elRadio" @change="queryByTypeSupplier">
        <el-radio :label="false" v-cloak><!--按实际收货数量打印-->{{nowLangue.printByReal}}</el-radio>
        <el-radio :label="true" v-cloak><!--按ASN数量打印-->{{nowLangue.printByASN}}</el-radio>
      </el-radio-group>
      <el-form :inline="true" :model="printedSpareSupplier" class="demo-form-inline">
        <!--ASN编号-->
        <el-form-item :label="nowLangue.ASNcode" class="selectMB10">
          <el-input  v-model="printedSpareSupplier.asnCode" :placeholder="nowLangue.pleaseImport+nowLangue.ASNcode"></el-input>
        </el-form-item>
        <!--PO编号-->
        <el-form-item :label="nowLangue.POcode" class="selectMB10">
          <el-input  v-model="printedSpareSupplier.orderCode" :placeholder="nowLangue.pleaseImport+nowLangue.POcode"></el-input>
        </el-form-item>
        <!--订单类型-->
        <el-form-item :label="nowLangue.orderType" class="selectMB10">
          <el-select size="mini" :placeholder="nowLangue.pleaseSelect" clearable v-model="printedSpareSupplier.orderType">
              <el-option v-for="(sourceMode,index) in orderTypeData" :key="index" :label="sourceMode.label" :value="sourceMode.value"></el-option>
          </el-select>
        </el-form-item>
        <!--供应商编号-->
        <el-form-item :label="nowLangue.supperCode" class="selectMB10">
          <el-input  v-model="printedSpareSupplier.supplierCode" :placeholder="nowLangue.pleaseImport+nowLangue.supperCode"></el-input>
        </el-form-item>
        <!--供应商名称-->
        <el-form-item :label="nowLangue.supperName" class="selectMB10">
          <el-input  v-model="printedSpareSupplier.supplierName" :placeholder="nowLangue.pleaseImport+nowLangue.supperName"></el-input>
        </el-form-item>
        <!--备件编号-->
        <el-form-item :label="nowLangue.spareCode" class="selectMB10">
          <el-input  v-model="printedSpareSupplier.materialCode" :placeholder="nowLangue.pleaseImport+nowLangue.spareCode"></el-input>
        </el-form-item>
        <!--备件名称-->
        <el-form-item :label="nowLangue.spareName" class="selectMB10">
          <el-input  v-model="printedSpareSupplier.materialName" :placeholder="nowLangue.pleaseImport+nowLangue.spareName"></el-input>
        </el-form-item>
        <el-form-item class="selectMB10">
          <el-button class="bolder outsideBtnBS selectAll" :disabled="selectDisabled" @click="queryByTypeSupplier" size="mini" type="danger" v-text="nowLangue.query"><!--查询--></el-button>
        </el-form-item>
        <el-form-item class="selectMB10">
          <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="confirmSupplierSpare" v-text="nowLangue.confirm"><!--确定--></el-button>
        </el-form-item>
      </el-form>
      <div>
        <label class="default-label" v-text="nowLangue.loadPrintList"><!--待打印备件条码列表--></label>
      </div>
      <el-table :data="loadPrintSupplierData" border style="width: 100%" v-loading.body="loading2">
        <!--序-->
        <el-table-column type="index" header-align="center" align="center" :label="nowLangue.xu" width="40" show-overflow-tooltip></el-table-column>
        <!--选择-->
        <el-table-column  :label="nowLangue.sel" header-align="center" align="center" width="40">
          <template scope="scope">
            <el-radio v-model="defaultLoadPrintSupplier" :label="scope.row" size="mini">&nbsp;</el-radio>
          </template>
        </el-table-column>
        <!--备件编码-->
        <el-table-column prop="materialCode" :label="nowLangue.spareCode" header-align="center" show-overflow-tooltip></el-table-column>
        <!--备件名称-->
        <el-table-column prop="materialName" :label="nowLangue.spareName" header-align="center" show-overflow-tooltip></el-table-column>
        <!--计量单位-->
        <el-table-column prop="unit" :label="nowLangue.measureUnit" header-align="center" show-overflow-tooltip></el-table-column>
        <!--收货单编号-->
        <el-table-column prop="receiptNo" v-if="!selectType2" :label="nowLangue.measureUnit" header-align="center" show-overflow-tooltip></el-table-column>
        <!--ASN数量-->
        <el-table-column prop="asnQuantity" :label="nowLangue.ASNnum" header-align="center" show-overflow-tooltip></el-table-column>
        <!--收货数量-->
        <el-table-column prop="receiptQuantity" v-if="!selectType2" :label="nowLangue.receiveGoodsNum" header-align="center" show-overflow-tooltip></el-table-column>
        <!--ASN编号-->
        <el-table-column prop="asnCode" :label="nowLangue.ASNcode" header-align="center" show-overflow-tooltip></el-table-column>
        <!--PO编号-->
        <el-table-column prop="orderCode" :label="nowLangue.POcode" header-align="center" show-overflow-tooltip></el-table-column>
        <!--供应商编码-->
        <el-table-column prop="supplierCode" :label="nowLangue.supperCode" header-align="center" show-overflow-tooltip></el-table-column>
        <!--供应商名称-->
        <el-table-column prop="supplierName" :label="nowLangue.supperName" header-align="center" show-overflow-tooltip></el-table-column>
        <!--已生成数量-->
        <el-table-column prop="produceQuantity" :label="nowLangue.generatedNum" header-align="center" show-overflow-tooltip></el-table-column>
        <!--未生成数量-->
        <el-table-column prop="noProduceQuantity" :label="nowLangue.notGeneratedNum" header-align="center" show-overflow-tooltip></el-table-column>
      </el-table>
      <!--分页-->
      <el-pagination v-if="isPaging4" @size-change="handleSizeChange4" @current-change="handleCurrentChange4" :current-page.sync="currentPage4" :current-page="pageIndex4"  :page-size="pageSize4" layout="total, sizes, prev, pager, next, jumper" :page-count="totalPage4" :total="totalNumber4"></el-pagination>
    </el-dialog>
    <!--供应商 供应商条码导入弹窗-->
    <el-dialog :title="nowLangue.exportTitle" id="LeadIngInMark2" :visible.sync="importDialog2" size="tiny"  :lock-scroll=false>
      <el-upload class="upload-demo" :action="actionSupplier"  :on-preview="handlePreviewSupplier" :on-remove="handleRemoveSupplier"
                 :file-list="fileListSupplier" :on-success="handleAvatarSuccessSupplier" :before-upload="beforeAvatarUploadSupplier" :data="{materialCode:formInlineSupplier.materialCode}">
        <el-button size="mini" type="danger" v-text="nowLangue.choseExport"></el-button>
        <div slot="tip" class="el-upload__tip" v-text="nowLangue.choseExportTip"></div>
      </el-upload>
    </el-dialog>
    <!--供应商 供应商条码扫描弹窗-->
    <el-dialog  :title="nowLangue.scanTitle" :visible.sync="scan2Visible">
      <div class="marginBot abs">
        <el-button class="bolder outsideBtnBS" size="mini" type="danger" @click="confirmScanSupplier" v-text="nowLangue.confirm"><!--确定--></el-button>
        <el-button class="bolder outsideBtnBS" size="mini" type="danger" v-text="nowLangue.returnAdd"><!--返加--></el-button>
      </div>
      <el-form :inline="true"  class="demo-form-inline pb0">
        <!--扫描条码信息-->
        <el-form-item class="selectMB0" :label="nowLangue.scanBarcodeInfor">
          <el-input class="marginBot" size="mini" v-model="scanBarCodeSupplier" @keyup.enter.native="scanInTableSuppllier($event)"></el-input>
        </el-form-item>
      </el-form>
      <el-table :data="scanBarCodeSupplierData" border style="width: 100%" v-loading.body="loading2">
        <!--序-->
        <el-table-column type="index" header-align="center" align="center" :label="nowLangue.xu" width="40" show-overflow-tooltip></el-table-column>
        <!--备件SN-->
        <el-table-column prop="spareSN" :label="nowLangue.spareSN" header-align="center" show-overflow-tooltip></el-table-column>
      </el-table>
    </el-dialog>
    <!--供应商 打印预览弹窗-->
    <el-dialog :title="nowLangue.printLenovoPreview" size="tiny" :visible.sync="dialogSupplierPreviewVisible" @close="handleCloseSupplierPreview">
        <div v-for="(barcode,index) in snCodeList2" :key="index">
          <!--根据包装方式循环-->
          <div v-for="(type,num) in printModeForSupplier" :key="num" class="print-wrap clearfix">
              <div class="print-top clearfix">
                  <!--箱标和区别码-->
                  <div class="print-top-left">
                      <div class="leFlagWrap">
                          <img class="leFlag" v-if="(type==1 && formInlineSupplier.printMode==2) || type==2 || type==3" src="../../../images/le.png" alt="">
                      </div>
                      <span class="diffCode" v-if="formInlineSupplier.diffFlag" v-text="formInlineSupplier.diffCode1"></span>
                  </div>
                  <!--条码-->
                  <img class="barCode" :src="imgListSupplier[index]"/>
              </div>
              <div class="print-bot clearfix">
                  <!--lenovo标-->
                  <div class="lenovoFlagWrap">
                      <img v-if="formInlineSupplier.lenovoFlag" class="lenovoFlag" src="../../../images/logo.png" alt="">
                  </div>
                  <!--条码内容-->
                  <p class="barCodeText" v-text="barcode"></p>
              </div>
          </div>
        </div>
    </el-dialog>
    <!--生成联想技服条码图片存放-->
    <div v-for="(barcode,index) in snCodeList" :key="index" class="clearfix" style="width:0px;height:0px;">
      <img :id="'barcode'+index" style="width:0px;height:0px;"/>
    </div>
    <!--生成供应商条码图片存放-->
    <div v-for="(barcodeSupplier,index) in snCodeList2" :key="index" class="clearfix" style="width:0px;height:0px;">
      <img :id="'barcodeSupplier'+index" style="width:0px;height:0px;"/>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
          nowLangue:{},
          languageScoped:{
              zh:{
                  "lenvoBarCode":"联想技服条码",
                  "supperBarCode":"供应商条码",
                  "judgeName":"法人名称",
                  "pleaseSelect":"请选择",
                  "startOpen":"启用",
                  "forbidden":"禁用",
                  "operator":"操作人员",
                  "operateDate":"操作日期",
                  "spareCode":"备件编码",
                  "spareName":"备件名称",
                  "thisBuildNum":"本次生成数量",
                  "scan":"扫描",
                  "importIn":"导入",
                  "barCodeType":"条码类型",
                  "diffCode1":"区别码1",
                  "diffCode2":"区别码2",
                  "printDifferCode":"打印区别码",
                  "barCodePrintAddress":"条码打印地",
                  "orignAddress":"来源地区",
                  "orignWay":"来源方式",
                  "printWay":"打印方式",
                  "printLenvo":"打印Lenovo标记",
                  "selectPrint":"选择打印机",
                  "create":"生成",
                  "createAgain":"重新生成",
                  "printPreview":"打印预览",
                  "print":"打印",
                  "createAndPrint":"生成并打印",
                  "spareBarCodeList":"备件技服条码列表",
                  "xu":"序",
                  "SNcode":"SN（或商品条码）",
                  "createTime":"生成时间",
                  "goodsBarCode":"商品条码",
                  "barCodeClass":"条码类别",
                  "spareSupperCodeList":"备件供应商条码列表",
                  "printByReal":"按实际收货数量打印",
                  "printByASN":"按ASN数量打印",
                  "ASNcode":"ASN编号",
                  "POcode":"PO编号",
                  "orderType":"订单类型",
                  "supperCode":"供应商编号",
                  "supperName":"供应商名称",
                  "query":"查询",
                  "confirm":"确定",
                  "loadPrintList":"待打印备件条码列表",
                  "sel":"选",
                  "measureUnit":"计量单位",
                  "ASNnum":"ASN数量",
                  "receiveGoodsNum":"收货数量",
                  "generatedNum":"已生成数量",
                  "notGeneratedNum":"未生成数量",
                  "exportTitle":"导入商品映射关系",
                  "choseExport":"请选择导入文件",
                  "choseExportTip":"只能上传excel文件",
                  "scanTitle":"扫描输入条码信息",
                  "returnAdd":"返回",
                  "scanBarcodeInfor":"扫描条码信息",
                  "spareSN":"备件SN",
                  "pleaseImport":"请输入",
                  "required":"必填项",
                  "receiptNo":"收货单编号",
                  "printLenovoPreview":"条码打印预览"
              },
              en:{
                  "lenvoBarCode":"lenvoBarCode",
                  "supperBarCode":"supperBarCode",
                  "judgeName":"judgeName",
                  "pleaseSelect":"pleaseSelect",
                  "startOpen":"startOpen",
                  "forbidden":"forbidden",
                  "operator":"operator",
                  "operateDate":"operateDate",
                  "spareCode":"spareCode",
                  "spareName":"spareName",
                  "thisBuildNum":"thisBuildNum",
                  "scan":"scan",
                  "importIn":"importIn",
                  "barCodeType":"barCodeType",
                  "diffCode1":"diffCode1",
                  "diffCode2":"diffCode2",
                  "printDifferCode":"printDifferCode",
                  "barCodePrintAddress":"barCodePrintAddress",
                  "orignAddress":"orignAddress",
                  "orignWay":"orignWay",
                  "printWay":"printWay",
                  "printLenvo":"printLenvo",
                  "selectPrint":"selectPrint",
                  "create":"create",
                  "createAgain":"createAgain",
                  "printPreview":"printPreview",
                  "print":"print",
                  "createAndPrint":"createAndPrint",
                  "spareBarCodeList":"spareBarCodeList",
                  "xu":"xu",
                  "SNcode":"SNcode",
                  "createTime":"createTime",
                  "goodsBarCode":"goodsBarCode",
                  "barCodeClass":"barCodeClass",
                  "spareSupperCodeList":"spareSupperCodeList",
                  "printByReal":"printByReal",
                  "printByASN":"printByASN",
                  "ASNcode":"ASNcode",
                  "POcode":"POcode",
                  "orderType":"orderType",
                  "supperCode":"supperCode",
                  "supperName":"supperName",
                  "query":"query",
                  "confirm":"confirm",
                  "loadPrintList":"loadPrintList",
                  "sel":"sel",
                  "measureUnit":"measureUnit",
                  "ASNnum":"ASNnum",
                  "receiveGoodsNum":"receiveGoodsNum",
                  "generatedNum":"generatedNum",
                  "notGeneratedNum":"notGeneratedNum",
                  "exportTitle":"exportTitle",
                  "choseExport":"choseExport",
                  "choseExportTip":"choseExportTip",
                  "scanTitle":"scanTitle",
                  "returnAdd":"returnAdd",
                  "scanBarcodeInfor":"scanBarcodeInfor",
                  "spareSN":"spareSN",
                  "pleaseImport":"pleaseImport ",
                  "required":"required",
                  "receiptNo":"receiptNo",
                  "printLenovoPreview":"printLenovoPreview"
              }
          },
          activeName2: 'first',
          legalPersonDropDown:[],//法人集合
          //联想技服
          formInline:{
              legalPersonCode:'',
              legalPersonName:'',
              materialCode: "",
              createQuantity: '',
              region: '',
              regionName:'',
              sourceMode: '',
              sourceModeName:'',
              sourceRegion: '',
              sourceRegionName:'',
              materialName:'',
              SNcode:'',
              diffCode1:'',
              diffCode2:'',
              operationTime:'',
              personName:"",
              snType:'',
              printMode:'',//打印方式
              printerType:'',//打印机
              lenovoFlag:true,//打印lenovo标记
              diffFlag:false,//打印区别码
          },
          formInlineSupplier:{
              legalPersonCode:'',
              legalPersonName:'',
              materialCode: "",
              createQuantity: '',
              region: '',
              regionName:'',
              sourceMode: '',
              sourceModeName:'',
              sourceRegion: '',
              sourceRegionName:'',
              materialName:'',
              SNcode:'',
              diffCode1:'',
              diffCode2:'',
              operationTime:'',
              personName:"",
              snType:'',
              printMode:'',
              printerType:'',
              lenovoFlag:true,//打印lenovo标记
              diffFlag:false,//打印区别码
              dataType:'1',//条码类别，是商品条码还是供应商条码
          },
          /*========联想==========================================*/
          printedSpare:{
              asnCode: "",
              orderCode: "",
              orderType: "",
              supplierCode: "",
              supplierName:""
          },
          loadPrintLenovoData:[],//待打印备件条码列表
          defaultLoadPrintLenovo:{},//选中的待打印备件条码
          spareJiFuData:[],//显示得备件技服条码列表
          spareJiFuDataAll:[],//备件技服条码列表
          snCodeList:[],//技服条码集合
          supplierSnList:[],///供应商条码集合
          dialogForm1Visible:false,//选择备件编码弹窗
          dialogLenovoPreviewVisible:false,//预览弹窗
          selectType:false,//按实际收货数量打印(false)   按ASN数量打印(true)
          importDialog:false,//联想技服 供应商条码导入弹窗
          scanVisible:false,//联想技服 供应商条码扫描弹窗
          scanBarCodeLenovo:'',//扫描弹框中得input值
          scanBarCodeLenovoData:[],//扫描弹框表格
          printParmData:[],//打印参数信息列表
          printMethod:'',//打印方式

          imgList:[],//打印预览 存放条码图片src集合
          printModeFor:[],//预览时，根据包装方式
            //导入
          action:"",
          fileList:[],
          /*========供应商==========================================*/
          printedSpareSupplier:{
              asnCode: "",
              orderCode: "",
              orderType: "",
              supplierCode: "",
              supplierName:"",
              materialCode:"",
              materialName:""
          },
          loadPrintSupplierData:[],//待打印备件条码列表 供应商
          defaultLoadPrintSupplier:{},//选中的待打印备件条码
          spareSupplierData:[],//显示得备件供应商条码列表
          spareSupplierDataAll:[],//备件供应商条码列表
          supplierSnList2:[],///供应商条码集合  对象形式{spareSN:1001}
          snCodeList2:[],//供应商条码集合 [1001,1002]
          dialogForm2Visible:false,//供货商 选择备件编码弹窗
          selectType2:false,//供货商 按实际收货数量打印(false)   按ASN数量打印(true)
          importDialog2:false,//供货商  供应商条码导入弹窗
          scan2Visible:false,//供货商  供应商条码扫描弹窗

          dialogSupplierPreviewVisible:false,//打印预览
          printModeForSupplier:[],//预览时，根据包装方式
          imgListSupplier:[],//打印预览 存放条码图片src集合

          scanBarCodeSupplier:'',//扫描弹框中得input值
          scanBarCodeSupplierData:[],//扫描弹框表格
          printParmSupplierData:[],//打印参数信息列表
          printMethodSupplier:'',//打印方式
            //导入
          actionSupplier:"",
          fileListSupplier:[],
          /*========分页==========================================*/
          loading:false,
          isPaging:false,    //是否显示分页
          pageIndex:1,    //当前页（必传）
          pageSize :10,   //每页多少条
          currentPage:3,    //当前显示3页
          totalNumber: 20,     //总条数
          totalPage:2 ,   //总页数

          loading2:false,
          isPaging2:false,    //是否显示分页
          pageIndex2:1,    //当前页（必传）
          pageSize2 :10,   //每页多少条
          currentPage2:3,    //当前显示3页
          totalNumber2: 20,     //总条数
          totalPage2:2 ,   //总页数

          loading3:false,
          isPaging3:false,    //是否显示分页
          pageIndex3:1,    //当前页（必传）
          pageSize3 :10,   //每页多少条
          currentPage3:3,    //当前显示3页
          totalNumber3: 20,     //总条数
          totalPage3:2  ,  //总页数

          loading4:false,
          isPaging4:false,    //是否显示分页
          pageIndex4:1,    //当前页（必传）
          pageSize4 :10,   //每页多少条
          currentPage4:3,    //当前显示3页
          totalNumber4: 20,     //总条数
          totalPage4:2 ,   //总页数
        /*========下拉框集合==========================================*/
          barCodeTypeData:[],//条码类别
          orderTypeData:[],//订单类型(同来源方式取值相同)
          snTypeData:[],//条码类型
          diffCode1Data:[],//区别码1
          diffCode2Data:[],//区别码2
          codeSourceData:[],//条码打印地
          sourceRegionData:[],//来源地区
          sourceModeData:[],//来源方式
          printModeData:[],//打印方式
          printerTypeData:[],//选择打印机
          //查询禁用
          selectDisabled:false,
          printLenovoDisabled:false,
          printSupplierDisabled:false,
          //打印
          printLenovoObj:new Zebra(),//创建一个联想技服条码的打印对象
          selected_printer: null,//联想技服条码选中得打印机
          default_mode: true,
          available_printers: null,//所有打印机
          selected_category: null,
          default_printer: null,//默认打印机
          format_start: "^XA ",
          format_end: "^XZ",
          format_content:"",
          isPrintMode4Flag:false,//打印三包装时，打印第二次外包装的判断
          printLenovoIndex:0,//联想技服条码打印下标

          printSupplierObj:new Zebra(),//创建一个供应商条码的打印对象
          format_content_supplier:"",//供应商条码对应的ZPL内容
          selected_printer_supplier: null,//供应商条码选中得打印机
          isPrintModeSupplier4Flag:false,//供应商条码打印 打印三包装时，打印第二次外包装的判断
          printSupplierIndex:0,//供应商条码打印下标
      };
    },
    created:function(){
        this.languageType=="zh"?this.nowLangue=this.languageScoped.zh:this.nowLangue=this.languageScoped.en;
    },
    computed:{
        languageType(){
            return this.$store.state.languageType;
        }
    },
    watch:{
        languageType(){
            this.languageType=="zh"?this.nowLangue=this.languageScoped.zh:this.nowLangue=this.languageScoped.en;
        }
    },
    mounted:function(){
        var _this=this;
        this.action=_this.metadata_service+'barCode/barCodeImport';
        this.actionSupplier=_this.metadata_service+'barCode/barCodeImport'
        this.legalPersonDropDownValue(); //法人名称下拉列表值
        this.queryDropDownCommon();
        this.queryOpera();
        this.setup_web_print();//打印初始化
     },
    methods: {
        setup_web_print(){
            var _this=this;
            this.default_mode = true;
            this.selected_printer = null;
            this.available_printers = null;
            this.selected_category = null;
            this.default_printer = null;
            BrowserPrint.getDefaultDevice('printer', function(printer) {
                    _this.default_printer = printer;
                    if((printer != null) && (printer.connection != undefined)) {
                        _this.selected_printer = printer;
                    }
                    BrowserPrint.getLocalDevices(function(printers) {
                        _this.available_printers = printers;
                        if(_this.available_printers){
                            if(_this.available_printers.length==1){
                                //当打印机只有一个时，直接显示
                                _this.formInline.printerType=_this.available_printers[0].uid;
                                _this.formInlineSupplier.printerType=_this.available_printers[0].uid;
                            }
                        }else{
                            _this.common.errorTip("No Available Printers.");
                        }
                        var printers_available = false;
                        if (printers != undefined) {
                            for(var i = 0; i < printers.length; i++) {
                                if (printers[i].connection == 'usb') {
                                    printers_available = true;
                                }
                            }
                        }
                        if(!printers_available) {
                            _this.common.errorTip("No Zebra Printers could be found!");
                            return;
                        }
                        else if(_this.selected_printer == null) {
                            _this.default_mode = false;
                        }
                    }, undefined, 'printer');
                },
                function(error_response) {
                    _this.common.errorTip("An error occured while attempting to connect to your Zebra Printer. You may not have Zebra Browser Print installed, or it may not be running. Install Zebra Browser Print, or start the Zebra Browser Print Service, and try again.");
                });
        },
        handleClick(tab, event) {
//          console.log(tab, event);
        },
        //所有得下拉框
        queryDropDownCommon(){
            var _this=this;
            var tmp=[
                "sn.barCodeType",
                "sn.sourceMode",
                "sn.snType",
                "sn.diffCode1",
                "sn.diffCode2",
                "sn.codeSource",
                "sn.sourceRegion",
                "sn.sourceMode",
                "sn.printMode",
                "sn.printerType"
            ];
            $.ajax({
                type:'POST',
                url:_this.metadata_service+'metadata/getPullDownList',
                cache:false,
                data:JSON.stringify(tmp),
                dataType:'JSON',
                contentType:"application/json;charset=utf-8",
                success:function(data){
                    if(data.success){
                        _this.barCodeTypeData=data.data['sn.barCodeType'];//条码类别
                        _this.orderTypeData=data.data['sn.sourceMode'];//订单类型(同来源方式取值相同)
                        _this.snTypeData=data.data['sn.snType'];//条码类型
                        _this.diffCode1Data=data.data['sn.diffCode1'];//区别码1
                        _this.diffCode2Data=data.data['sn.diffCode2'];//区别码2
                        _this.codeSourceData=data.data['sn.codeSource'];//条码打印地
                        _this.sourceRegionData=data.data['sn.sourceRegion'];//来源地区
                        _this.sourceModeData=data.data['sn.sourceMode'];//来源方式
                        _this.printModeData=data.data['sn.printMode'];//打印方式
                        _this.printerTypeData=data.data['sn.printerType'];//选择打印机
                    }else{
                        _this.common.errorTip(data.errorMessage);
                    }
                }
            })
        },
        //法人名称下拉列表值
        legalPersonDropDownValue(){
          var _this = this;
          $.ajax({
              type:'GET',
              url:_this.procurement_service+"legalPerson/ofCurrentUser",
              cache:false,
              success:function(data){
                  if(data.success){
                      _this.legalPersonDropDown = data.data;
                      if(_this.legalPersonDropDown.length==1){
                          _this.formInline.legalPersonCode=_this.legalPersonDropDown[0].legalPersonCode;
                          _this.formInline.legalPersonName=_this.legalPersonDropDown[0].legalPersonName;
                          _this.formInlineSupplier.legalPersonCode=_this.legalPersonDropDown[0].legalPersonCode;
                          _this.formInlineSupplier.legalPersonName=_this.legalPersonDropDown[0].legalPersonName;
                      }
                  }else{
                      _this.common.errorTip(data.errorMessage);
                  }
              }
          })
        },
        // 选择法人 取id、legalPersonCode
        changeLegalPerson(){
          var _this = this;
          for(var i=0;i<_this.legalPersonDropDown.length;i++){
              if(_this.formInline.legalPersonCode==_this.legalPersonDropDown[i].legalPersonCode){
                  _this.formInline.legalPersonName=_this.legalPersonDropDown[i].legalPersonName;
              }
          }
        },
        changeCodeSourceLenovo(){
            for(var i=0;i<this.codeSourceData.length;i++){
                if(this.formInline.region==this.codeSourceData[i].value){
                    this.formInline.regionName=this.codeSourceData[i].label;
                }
            }
        },
        changeSourceRegionLenovo(){
            for(var i=0;i<this.sourceRegionData.length;i++){
                if(this.formInline.sourceRegion==this.sourceRegionData[i].value){
                    this.formInline.sourceRegionName=this.sourceRegionData[i].label;
                }
            }
        },
        changeSourceModeLenovo(){
            for(var i=0;i<this.sourceModeData.length;i++){
                if(this.formInline.sourceMode==this.sourceModeData[i].value){
                    this.formInline.sourceModeName=this.sourceModeData[i].label;
                }
            }
        },
        changeCodeSourceSupplier(){
            for(var i=0;i<this.codeSourceData.length;i++){
                if(this.formInlineSupplier.region==this.codeSourceData[i].value){
                    this.formInlineSupplier.regionName=this.codeSourceData[i].label;
                }
            }
        },
        changeSourceRegionSupplier(){
            for(var i=0;i<this.sourceRegionData.length;i++){
                if(this.formInlineSupplier.sourceRegion==this.sourceRegionData[i].value){
                    this.formInlineSupplier.sourceRegionName=this.sourceRegionData[i].label;
                }
            }
        },
        changeSourceModeSupplier(){
            for(var i=0;i<this.sourceModeData.length;i++){
                if(this.formInlineSupplier.sourceMode==this.sourceModeData[i].value){
                    this.formInlineSupplier.sourceModeName=this.sourceModeData[i].label;
                }
            }
        },
        changeLegalPersonSupplier(){
            var _this = this;
            for(var i=0;i<_this.legalPersonDropDown.length;i++){
                if(_this.formInlineSupplier.legalPersonCode==_this.legalPersonDropDown[i].legalPersonCode){
                    _this.formInlineSupplier.legalPersonName=_this.legalPersonDropDown[i].legalPersonName;
                }
            }
        },
        //获取操作人员与操作时间
        queryOpera(){
          var _this=this;
          $.ajax({
              type:'GET',
              url:_this.metadata_service+'barCode/createInitParameter',
              cache:false,
              dataType:'JSON',
              contentType:"application/json;charset=utf-8",
              success:function(data){
                  if(data.success){
                      _this.formInline.personName=data.data.personName;
                      _this.formInline.operationTime=data.data.operationTime;
                      _this.formInlineSupplier.personName=data.data.personName;
                      _this.formInlineSupplier.operationTime=data.data.operationTime;
                  }else{
                      _this.common.errorTip(data.errorMessage);
                  }
              }
          })
        },
        //排重
        isHave(value,arr){
            for(var i=0;i<arr.length;i++){
                if(value==arr[i].spareSN){
                    return false;
                }
            }
            return true
        },
        /*=============================================联想技服条码tab=======================================================================================*/
        //选择打印机
        changeLenovoType(){
            for(var i=0;i<this.available_printers.length;i++){
                if(this.available_printers[i].uid==this.formInline.printerType){
                    this.selected_printer=this.available_printers[i];
                }
            }
        },
        checkPrinterStatus(finishedFunction){
            var _this=this;
            _this.selected_printer.sendThenRead("~HQES",
                function(text){
                    var that = this;
                    var statuses = new Array();
                    var ok = false;
                    var is_error = text.charAt(70);
                    var media = text.charAt(88);
                    var head = text.charAt(87);
                    var pause = text.charAt(84);
                    // check each flag that prevents printing
                    if (is_error == '0')
                    {
                        ok = true;
                        statuses.push("Ready to Print");
                    }
                    if (media == '1')
                        statuses.push("Paper out");
                    if (media == '2')
                        statuses.push("Ribbon Out");
                    if (media == '4')
                        statuses.push("Media Door Open");
                    if (media == '8')
                        statuses.push("Cutter Fault");
                    if (head == '1')
                        statuses.push("Printhead Overheating");
                    if (head == '2')
                        statuses.push("Motor Overheating");
                    if (head == '4')
                        statuses.push("Printhead Fault");
                    if (head == '8')
                        statuses.push("Incorrect Printhead");
                    if (pause == '1')
                        statuses.push("Printer Paused");
                    if ((!ok) && (statuses.Count == 0))
                        statuses.push("Error: Unknown Error");
                    finishedFunction(statuses.join());
                }, _this.printerError);
        },
        printerError(text){
            this.common.errorTip("An error occurred while printing. Please try again." + text);
        },
        //内包装打印
        printInner(){
            var _this=this;
            this.printLenovoObj.printMode = "1";//打印内外包装码 1内包装 2外包装
            this.printLenovoObj.toZPL();//获取ZPL语言
            this.format_content=this.printLenovoObj.format_content;
            this.checkPrinterStatus( function (text){
                if (text == "Ready to Print") {
                    _this.selected_printer.send(_this.format_start + _this.format_content + _this.format_end, function(){
                        _this.common.successTip("Print Inner Success");
                        //多个条码 内包装打印
                        if(_this.formInline.printMode == "1" && _this.printLenovoIndex<_this.snCodeList.length){
                            _this.printLenovoIndex++;
                            _this.printFinally();
                        }
                        //双包装或者三包装打印 内->外
                        if(_this.formInline.printMode == "3" || _this.formInline.printMode == "4"){
                            _this.isPrintMode4Flag=true;
                            _this.printOuter();
                        }
                    }, function(){
                        _this.common.errorTip("Print Inner Error");
                    });
                }
                else {
                    _this.common.errorTip("errorInner");
                }
            });
        },
        //外包装打印
        printOuter(){
            var _this=this;
            this.printLenovoObj.printMode = "2";//打印内外包装码 1内包装 2外包装
            this.printLenovoObj.toZPL();//获取ZPL语言
            this.format_content=this.printLenovoObj.format_content;
            this.checkPrinterStatus( function (text){
                if (text == "Ready to Print") {
                    _this.selected_printer.send(_this.format_start + _this.format_content + _this.format_end, function(){
                        _this.common.successTip("Print Outer Success");
                        //多个条码 外包装打印
                        if(_this.formInline.printMode == "2" && _this.printLenovoIndex<_this.snCodeList.length){
                            _this.printLenovoIndex++;
                            _this.printFinally();
                        }
                        //多个条码打印 双包装
                        if(_this.formInline.printMode == "3" && _this.isPrintMode4Flag && _this.printLenovoIndex<_this.snCodeList.length){
                            _this.isPrintMode4Flag=false;
                            _this.printLenovoIndex++;
                            _this.printFinally();
                        }
                        //多个条码打印  三包装
                         if(_this.formInline.printMode == "4" && !_this.isPrintMode4Flag && _this.printLenovoIndex<_this.snCodeList.length){
                            _this.printLenovoIndex++;
                            _this.printFinally();
                        }
                        //三包装打印  从内->外->外  _this.isPrintMode4Flag：从内打调用外打true,外打调外打false
                        if(_this.formInline.printMode == "4" && _this.isPrintMode4Flag){
                            _this.isPrintMode4Flag=false;
                            _this.printOuter();
                        }
                    }, function(){
                        _this.common.errorTip("Print Outer Error");
                    });
                }
                else {
                    _this.common.errorTip("errorOuter");
                }
            });
        },
        //通过备件编码查询
        queryByType(){
            var _this=this;
            this.loadPrintLenovoData=[];
            _this.defaultLoadPrintLenovo={};
            this.loading2=true;
            this.selectDisabled=true;
            if(!_this.selectType){
              _this.queryByReceive();
            }else{
              _this.queryByAsn();
            }
        },
        //通过实际收获数量查询
        queryByReceive(){
          var _this=this;
            _this.loadPrintLenovoData=[];
          var tmp={
              asnCode: _this.printedSpare.asnCode,
              orderCode: _this.printedSpare.orderCode,
              orderType: _this.printedSpare.orderType,
              supplierCode: _this.printedSpare.supplierCode,
              supplierName: _this.printedSpare.supplierName,
              printMethod:1,
              pageIndex: _this.pageIndex2,
              pageSize: _this.pageSize2,
          };
          $.ajax({
              type:'POST',
              url:_this.metadata_service+'barCode/queryActualReceiptQuantityPage',
              cache:false,
              data:JSON.stringify(tmp),
              dataType:'JSON',
              contentType:"application/json;charset=utf-8",
              success:function(data){
                  _this.loading2=false;
                  _this.selectDisabled=false;
                  if(data.success){
                      _this.isPaging2=true;
                      _this.totalPage2=data.data.totalPage;
                      _this.totalNumber2=data.data.totalNumber;
                      _this.loadPrintLenovoData=data.data.dataList;
                  }else{
                      _this.common.errorTip(data.errorMessage);
                  }
              },
              error:function(){
                  _this.loading2=false;
                  _this.selectDisabled=false;
              }
          })
        },
        //通过ASN数量查询
        queryByAsn(){
          var _this=this;
            _this.loadPrintLenovoData=[];
          var tmp={
              asnCode: _this.printedSpare.asnCode,
              orderCode: _this.printedSpare.orderCode,
              orderType: _this.printedSpare.orderType,
              supplierCode: _this.printedSpare.supplierCode,
              supplierName: _this.printedSpare.supplierName,
              printMethod:2,
              pageIndex: _this.pageIndex2,
              pageSize: _this.pageSize2,
          };
          $.ajax({
              type:'POST',
              url:_this.metadata_service+'barCode/queryASNQuantityPage',
              cache:false,
              data:JSON.stringify(tmp),
              dataType:'JSON',
              contentType:"application/json;charset=utf-8",
              success:function(data){
                  if(data.success){
                      _this.loading2=false;
                      _this.selectDisabled=false;
                      _this.isPaging2=true;
                      _this.totalPage2=data.data.totalPage;
                      _this.totalNumber2=data.data.totalNumber;
                      _this.loadPrintLenovoData=data.data.dataList;
                  }else{
                      _this.loading2=false;
                      _this.selectDisabled=false;
                      _this.common.errorTip(data.errorMessage);
                  }
              }
          })
        },
        handleCloseLevono(){
            this.loading2=false;
        },
        //填
        inputQuantity(index,row){
            var _this=this;
            //做参数判断，只允许填入数字
            if(/^(\-?)(\d+)$/.test(row.thisProduceQuantity)){
                if(row.thisProduceQuantity<=row.noProduceQuantity){
                    _this.loadPrintLenovoData[index].thisProduceQuantity=row.thisProduceQuantity;
                }else{
                    var err = _this.languageType == "zh" ? '本次生成数量必须小于等于未生成数量！' : 'Have Number Limit Error';
                    _this.common.errorTip(err);
                }
            }else{
                var err1 = _this.languageType == "zh" ? '请填入数字！' : 'Number';
                _this.common.errorTip(err1);
            }
        },
        //联想技服条码备件选择确定
        confirmLenovoSpare(){
            var _this=this;
            _this.printMethod=_this.selectType?2:1;
            //加一层判断，必须选中才能确定
            if(JSON.stringify(_this.defaultLoadPrintLenovo)!="{}"){
                if(_this.defaultLoadPrintLenovo.thisProduceQuantity=="" || _this.defaultLoadPrintLenovo.thisProduceQuantity==null){
                    var err = _this.languageType == "zh" ? '请填入已选中的本次生成数量！' : 'Number';
                    _this.common.errorTip(err);
                }else if(/^(\-?)(\d+)$/.test(_this.defaultLoadPrintLenovo.thisProduceQuantity)){
                    if(_this.defaultLoadPrintLenovo.thisProduceQuantity<=_this.defaultLoadPrintLenovo.noProduceQuantity){
                        _this.validConfirm();
                    }else{
                        var err1 = _this.languageType == "zh" ? '本次生成数量必须小于等于未生成数量！' : 'Number';
                        _this.common.errorTip(err1);
                    }
                }else{
                    var err2 = _this.languageType == "zh" ? '请填入数字！' : 'Number';
                    _this.common.errorTip(err2);
                }
            }else{
                var err3 = _this.languageType == "zh" ? '请选中你要选择的待打印条码备件！' : 'Please Select';
                _this.common.errorTip(err3);
            }
        },
        //确定得验证
        validConfirm(){
            var _this=this;
            _this.printMethod=_this.selectType?2:1;
            var tmp={
                printMethod:_this.printMethod,
                materialCode:_this.defaultLoadPrintLenovo.materialCode,
                asnCode:_this.defaultLoadPrintLenovo.asnCode,
                orderCode:_this.defaultLoadPrintLenovo.orderCode,
            };
            $.ajax({
                type:'POST',
                url:_this.metadata_service+'barCode/validIfCanSelectMeterial',
                cache:false,
                data:JSON.stringify(tmp),
                dataType:'JSON',
                contentType:"application/json;charset=utf-8",
                success:function(data){
                    if(data.success){
                        _this.formInline.materialCode=_this.defaultLoadPrintLenovo.materialCode;
                        _this.formInline.materialName=_this.defaultLoadPrintLenovo.materialName;
                        _this.formInline.createQuantity=_this.defaultLoadPrintLenovo.thisProduceQuantity;
                        _this.formInline.sourceMode=_this.defaultLoadPrintLenovo.orderType;
                        _this.dialogForm1Visible=false;
                    }else{
                        _this.common.errorTip(data.errorMessage);
                    }
                }
            })
        },
        /*联想技服条码生成、重新生成*/
        createNew(){
            var _this = this;
            _this.spareJiFuDataAll=[];
            _this.printParmData=[];
            _this.loading=true;
            this.$refs['formInline'].validate((valid) => {
                if (valid) {
                    var tmp={
                        materialCode:_this.formInline.materialCode,
                        quantity:_this.formInline.createQuantity,
                        region:_this.formInline.region,
                        sourceMode:_this.formInline.sourceMode,
                        sourceRegion:_this.formInline.sourceRegion,
                    };
                    $.ajax({
                        type:'POST',
                        url:_this.metadata_service+'barCode/buildBarCodeNew',
                        cache:false,
                        data:JSON.stringify(tmp),
                        dataType:'JSON',
                        contentType:"application/json;charset=utf-8",
                        success:function(data){
                            if(data.success){
                                _this.loading=false;
                                _this.isPaging=true;
                                _this.totalNumber=data.data.length;
                                _this.totalPage=Math.ceil(this.totalNumber/this.pageSize);
                                _this.snCodeList=data.data;//需要打印得联想技服条码数组集合
                                for(var i=0;i<data.data.length;i++){
                                    //判断供应商条码是否存在
                                    var spareSN='';
                                    if(_this.supplierSnList[i]){
                                        spareSN=_this.supplierSnList[i].spareSN;
                                    }
                                    _this.spareJiFuDataAll.push({
                                        materialCode:_this.formInline.materialCode,
                                        materialName:_this.formInline.materialName,
                                        lenovoBarCode:data.data[i],
                                        SNcode:spareSN,
                                        diffCode1:_this.formInline.diffCode1,
                                        diffCode2:_this.formInline.diffCode2,
                                        barCodePrintAddress:_this.formInline.regionName,
                                        orignAddress:_this.formInline.sourceRegionName,
                                        orignWay:_this.formInline.sourceModeName,
                                        operationTime:_this.formInline.operationTime,
                                        personName:_this.formInline.personName
                                    });
                                }
                                _this.pageQueryLenovo();//分页查询
                            }else{
                                _this.loading=false;
                                _this.common.errorTip(data.errorMessage);
                            }
                        }
                    })
                } else {
                    var err = _this.languageType == "zh" ? '存在未填写的必填项！' : 'Have Empty';
                    _this.common.errorTip(err);
                }
            })
        },
        //前台实现分页查询
        pageQueryLenovo(){
            var _this=this;
            _this.spareJiFuData=_this.spareJiFuDataAll.slice((_this.pageIndex-1)*_this.pageSize,_this.pageIndex*_this.pageSize);
        },
        /*联想技服条码打印预览*/
        printLenovoPreview(){
            if(this.spareJiFuDataAll.length==0){
                var err = this.languageType == "zh" ? '条码列表不能为空！' : 'Have Empty';
                this.common.errorTip(err);
            }else{
                //条码预览
                if(this.formInline.printMode==1 || this.formInline.printMode==2){
                    this.printModeFor=[1];
                }else if(this.formInline.printMode==3){
                    this.printModeFor=[1,2];
                }else if(this.formInline.printMode==4){
                    this.printModeFor=[1,2,3];
                }
                this.dialogLenovoPreviewVisible=true;
                this.createJsbarcode();
            }
            return false;
        },
        //打印预览需生成的条码
        createJsbarcode(){
            this.imgList=[];
            for(var i=0;i<this.snCodeList.length;i++){
                this.jsbarcode(document.getElementById('barcode'+i),this.snCodeList[i],{
                    displayValue: false
                });
                var srcImg=document.getElementById('barcode'+i).src;
                this.imgList.push(srcImg);
            }

        },
        /*联想技服条码打印预览关闭*/
        handleCloseLenovoPreview(){

        },
        /*联想技服条码打印*/
        printLenovoBarCode(){
            if(this.snCodeList.length==0){
                var err = this.languageType == "zh" ? '条码列表不能为空！' : 'Have Empty';
                this.common.errorTip(err);
            }else{
                this.successPrint();
            }
            return false;
        },
        //确定能成功打印后，调用打印方法
        successPrint(){
            var _this=this;
             var supplierSnList=[];
            for(var i=0;i<this.snCodeList.length;i++){
                //传参 供应商条码集合，传数组
                if(this.supplierSnList[i]){
                    supplierSnList.push(this.supplierSnList[i].spareSN);
                }
            }
            var tmp={
                legalPersonCode:_this.formInline.legalPersonCode,
                legalPersonName:_this.formInline.legalPersonName,
                materialCode:_this.formInline.materialCode,
                materialName:_this.formInline.materialName,
                snCodeList:_this.snCodeList,
                supplierSnList:supplierSnList,
                createQuantity:_this.formInline.createQuantity,
                diffCode1:_this.formInline.diffCode1,
                diffCode2:_this.formInline.diffCode2,
                snCodeSource:_this.formInline.region,
                snType:_this.formInline.snType,
                sourceRegion:_this.formInline.sourceRegion,
                sourceMode:_this.formInline.sourceMode,
                asnCode: _this.defaultLoadPrintLenovo.asnCode,
                orderCode: _this.defaultLoadPrintLenovo.orderCode,
                orderType: _this.defaultLoadPrintLenovo.orderType,
                receiptNo:_this.defaultLoadPrintLenovo.receiptNo,
                supplierCode: _this.defaultLoadPrintLenovo.supplierCode,
                supplierName: _this.defaultLoadPrintLenovo.supplierName,
                printMethod:_this.printMethod
            };
            _this.printLenovoDisabled=true;
            $.ajax({
                type:'POST',
                url:_this.metadata_service+'barCode/saveSNInfo',
                cache:false,
                data:JSON.stringify(tmp),
                dataType:'JSON',
                contentType:"application/json;charset=utf-8",
                success:function(data){
                    _this.printLenovoDisabled=false;
                    if(data.success){
                        //调用打印
                        _this.printFinally();
                        //清空
                        setTimeout(function(){
                            _this.spareJiFuData=[];
                            _this.spareJiFuDataAll=[];
                        },0)
                    }else{
                        _this.common.errorTip(data.errorMessage);
                    }
                },
                error:function(){
                    _this.printLenovoDisabled=false;
                }
            })
        },
        //调用打印ZPL
        printFinally(){
            var _this=this;
            if(_this.printLenovoIndex>=_this.snCodeList.length){
                _this.printLenovoIndex=0;

            }else{
                this.printLenovoObj.barCode=_this.snCodeList[_this.printLenovoIndex];
                this.printLenovoObj.lenovoFlag = _this.formInline.lenovoFlag;//打印lenovo标记
                this.printLenovoObj.diffFlag = _this.formInline.diffFlag;//打印区别码标记
                this.printLenovoObj.diffCon = _this.formInline.diffCode1;//区别码内容
                //内包装     //双包装     三包装,两个外包装一个内包装
                if (_this.formInline.printMode == "1" || _this.formInline.printMode == "3" || _this.formInline.printMode == "4" ) {
                    _this.printInner();
                }
                //外包装
                else if (_this.formInline.printMode == "2") {
                    _this.printOuter();
                }
            }

        },
        //生成并打印
        createPrintLenovo(){
            var _this = this;
            _this.spareJiFuDataAll=[];
            _this.printParmData=[];
            this.$refs['formInline'].validate((valid) => {
                if (valid) {
                    var tmp={
                        materialCode:_this.formInline.materialCode,
                        quantity:_this.formInline.createQuantity,
                        region:_this.formInline.region,
                        sourceMode:_this.formInline.sourceMode,
                        sourceRegion:_this.formInline.sourceRegion,
                    };
                    $.ajax({
                        type:'POST',
                        url:_this.metadata_service+'barCode/buildBarCodeNew',
                        cache:false,
                        data:JSON.stringify(tmp),
                        dataType:'JSON',
                        contentType:"application/json;charset=utf-8",
                        success:function(data){
                            if(data.success){
                                _this.snCodeList=data.data;
                                _this.printLenovoBarCode();//打印
                            }else{
                                _this.common.errorTip(data.errorMessage);
                            }
                        }
                    })
                } else {
                    var err = _this.languageType == "zh" ? '存在未填写的必填项！' : 'Have Empty';
                    _this.common.errorTip(err);
                }
            })
        },
        /*联想技服条码*/
        selectSpare(){
            this.queryByType();
            this.dialogForm1Visible=true;
        },
        importIn(){
            if(this.formInline.materialCode!=null && this.formInline.materialCode!=""){
                this.importDialog=true;
            }else{
                var err = this.languageType == "zh" ? '请先选择备件编码！' : 'Please Select';
                this.common.errorTip(err);
            }
        },
        scanIn(){
            this.scanBarCodeLenovoData=[];
            if(this.formInline.materialCode!=null && this.formInline.materialCode!=""){
                this.scanVisible=true;
            }else{
                var err = this.languageType == "zh" ? '请先选择备件编码！' : 'Please Select';
                this.common.errorTip(err);
            }
        },
        //扫描导入数据
        scanInTable(event){
          if(event.keyCode==13){
             if(this.isHave(this.scanBarCodeLenovo,this.scanBarCodeLenovoData)){
                 if(this.scanBarCodeLenovoData.length<this.formInline.createQuantity){
                     this.scanBarCodeLenovoData.push({spareSN:this.scanBarCodeLenovo});
                 }else if(this.scanBarCodeLenovoData.length==this.formInline.createQuantity){
                     var err = this.languageType == "zh" ? '扫描数量已与本次生成数量相等！' : 'Please Select';
                     this.common.errorTip(err);
                 }
             }else{
                 var err1 = this.languageType == "zh" ? '条码已存在！' : 'Had Exist';
                 this.common.errorTip(err1);
             }
          }
          this.scanBarCodeLenovo='';
        },
        confirmScan(){
            if(this.scanBarCodeLenovoData.length==this.formInline.createQuantity){
                this.supplierSnList=this.scanBarCodeLenovoData;
                this.scanVisible=false;
            }else if(this.scanBarCodeLenovoData.length==0){
                var err = this.languageType == "zh" ? '扫描数量为空！' : 'Please Select';
                this.common.errorTip(err);
            }else{
                var err1 = this.languageType == "zh" ? '扫描数量小于本次生成数量！' : 'Please Select';
                this.common.errorTip(err1);
            }

        },
        returnClear(){
            this.scanBarCodeLenovoData=[];
            this.scanVisible=false;
        },
        //文件列表移除文件时的钩子
        handleRemove(file, fileList) {
//            console.log(file, fileList);
        },
        handlePreview(file) {
//            console.log(file);
        },
        //上传文件之前的钩子
        beforeAvatarUpload(file) {
            // console.log(file);
            const isExcel2007 = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
            const isExcel2003 = file.type === 'application/vnd.ms-excel';
            if (!isExcel2007 && !isExcel2003) {
                this.$message.error('只能上传excel文件!');
            }
            return isExcel2007 || isExcel2003 ;
        },
        // 文件上传成功时的钩子
        handleAvatarSuccess(res, file) {
            var _this=this;
            if(res.success) {
                if(res.data.length==this.formInline.createQuantity){
                    this.supplierSnList=[];
                    this.importDialog=false;
                    var succe = this.languageType == "zh" ? '上传成功！' : 'Successed';
                    _this.common.successTip(succe);
                    _this.fileList=[];
                    for(var i=0,j=res.data.length;i<j;i++){
                        this.supplierSnList.push({spareSN:res.data[i]});
                    }
                }else if(res.data.length==0){
                    var err = this.languageType == "zh" ? '导入数量为空！' : 'Successed';
                    this.common.errorTip(err);
                    _this.fileList=[];
                }else{
                    var err1 = this.languageType == "zh" ? '导入数量与本次生成数量不符！' : 'Successed';
                    this.common.errorTip(err1);
                    _this.fileList=[];
                }
            }else{
                _this.fileList=[];
                _this.common.errorTip(res.errorMessage);
            }
        },
        /*==============================================================供应商条码tab====================================================================================================*/
        //选择打印机
        changeSupplierType(){
            for(var i=0;i<this.available_printers.length;i++){
                if(this.available_printers[i].uid==this.formInlineSupplier.printerType){
                    this.selected_printer_supplier=this.available_printers[i];
                }
            }
        },
        checkPrinterSupplierStatus(finishedFunction){
            var _this=this;
            _this.selected_printer_supplier.sendThenRead("~HQES",
                function(text){
                    var that = this;
                    var statuses = new Array();
                    var ok = false;
                    var is_error = text.charAt(70);
                    var media = text.charAt(88);
                    var head = text.charAt(87);
                    var pause = text.charAt(84);
                    // check each flag that prevents printing
                    if (is_error == '0')
                    {
                        ok = true;
                        statuses.push("Ready to Print");
                    }
                    if (media == '1')
                        statuses.push("Paper out");
                    if (media == '2')
                        statuses.push("Ribbon Out");
                    if (media == '4')
                        statuses.push("Media Door Open");
                    if (media == '8')
                        statuses.push("Cutter Fault");
                    if (head == '1')
                        statuses.push("Printhead Overheating");
                    if (head == '2')
                        statuses.push("Motor Overheating");
                    if (head == '4')
                        statuses.push("Printhead Fault");
                    if (head == '8')
                        statuses.push("Incorrect Printhead");
                    if (pause == '1')
                        statuses.push("Printer Paused");
                    if ((!ok) && (statuses.Count == 0))
                        statuses.push("Error: Unknown Error");
                    finishedFunction(statuses.join());
                }, _this.printerError);
        },
        //内包装打印
        printSupplierInner(){
            var _this=this;
            this.printSupplierObj.printMode = "1";//打印内外包装码 1内包装 2外包装
            this.printSupplierObj.toZPL();//获取ZPL语言
            this.format_content_supplier=this.printSupplierObj.format_content;
            this.checkPrinterSupplierStatus( function (text){
                if (text == "Ready to Print") {
                    _this.selected_printer_supplier.send(_this.format_start + _this.format_content_supplier + _this.format_end, function(){
                        _this.common.successTip("Print Inner Success");
                        //多个条码 内包装打印
                        if(_this.formInlineSupplier.printMode == "1" && _this.printSupplierIndex<_this.snCodeList2.length){
                            _this.printSupplierIndex++;
                            _this.printSupplierFinally();
                        }
                        //双包装或者三包装打印 内->外
                        if(_this.formInlineSupplier.printMode == "3" || _this.formInlineSupplier.printMode == "4"){
                            _this.isPrintModeSupplier4Flag=true;
                            _this.printSupplierOuter();
                        }
                    }, function(){
                        _this.common.errorTip("Print Inner Error");
                    });
                }
                else {
                    _this.common.errorTip("errorInner");
                }
            });
        },
        //外包装打印
        printSupplierOuter(){
            var _this=this;
            this.printSupplierObj.printMode = "2";//打印内外包装码 1内包装 2外包装
            this.printSupplierObj.toZPL();//获取ZPL语言
            this.format_content_supplier=this.printSupplierObj.format_content;
            this.checkPrinterSupplierStatus( function (text){
                if (text == "Ready to Print") {
                    _this.selected_printer_supplier.send(_this.format_start + _this.format_content_supplier + _this.format_end, function(){
                        _this.common.successTip("Print Outer Success");
                        //多个条码 外包装打印
                        if(_this.formInlineSupplier.printMode == "2" && _this.printSupplierIndex<_this.snCodeList2.length){
                            _this.printSupplierIndex++;
                            _this.printSupplierFinally();
                        }
                        //多个条码打印 双包装
                        if(_this.formInlineSupplier.printMode == "3" && _this.isPrintModeSupplier4Flag && _this.printSupplierIndex<_this.snCodeList2.length){
                            _this.isPrintModeSupplier4Flag=false;
                            _this.printSupplierIndex++;
                            _this.printSupplierFinally();
                        }
                        //多个条码打印  三包装
                        if(_this.formInlineSupplier.printMode == "4" && !_this.isPrintModeSupplier4Flag && _this.printSupplierIndex<_this.snCodeList2.length){
                            _this.printSupplierIndex++;
                            _this.printSupplierFinally();
                        }
                        //三包装打印  从内->外->外  _this.isPrintModeSupplier4Flag：从内打调用外打true,外打调外打false
                        if(_this.formInlineSupplier.printMode == "4" && _this.isPrintModeSupplier4Flag){
                            _this.isPrintModeSupplier4Flag=false;
                            _this.printSupplierOuter();
                        }
                    }, function(){
                        _this.common.errorTip("Print Outer Error");
                    });
                }
                else {
                    _this.common.errorTip("errorOuter");
                }
            });
        },
        //通过备件编码查询
        queryByTypeSupplier(){
            var _this=this;
            _this.loading4=true;
            _this.selectDisabled=true;
            this.loadPrintSupplierData=[];
            if(!_this.selectType2){
                _this.queryByReceiveSupplier();
            }else{
                _this.queryByAsnSupplier();
            }
        },
        //通过实际收获数量查询
        queryByReceiveSupplier(){
            var _this=this;
            _this.loading4=true;
            var tmp={
                asnCode: _this.printedSpareSupplier.asnCode,
                orderCode: _this.printedSpareSupplier.orderCode,
                orderType: _this.printedSpareSupplier.orderType,
                supplierCode: _this.printedSpareSupplier.supplierCode,
                supplierName: _this.printedSpareSupplier.supplierName,
                materialCode: _this.printedSpareSupplier.materialCode,
                materialName: _this.printedSpareSupplier.materialName,
                printMethod:1,
                pageIndex: _this.pageIndex4,
                pageSize: _this.pageSize4,
            };
            $.ajax({
                type:'POST',
                url:_this.metadata_service+'barCode/queryActualReceiptQuantityPage',
                cache:false,
                data:JSON.stringify(tmp),
                dataType:'JSON',
                contentType:"application/json;charset=utf-8",
                success:function(data){
                    if(data.success){
                        _this.loading4=false;
                        _this.selectDisabled=false;
                        _this.isPaging4=true;
                        _this.totalPage4=data.data.totalPage;
                        _this.totalNumber4=data.data.totalNumber;
                        _this.loadPrintSupplierData=data.data.dataList;
                    }else{
                        _this.loading4=false;
                        _this.selectDisabled=false;
                        _this.common.errorTip(data.errorMessage);
                    }
                }
            })
        },
        //通过ASN数量查询
        queryByAsnSupplier(){
            var _this=this;
            _this.loading4=true;
            _this.loadPrintSupplierData=[];
            var tmp={
                asnCode: _this.printedSpareSupplier.asnCode,
                orderCode: _this.printedSpareSupplier.orderCode,
                orderType: _this.printedSpareSupplier.orderType,
                supplierCode: _this.printedSpareSupplier.supplierCode,
                supplierName: _this.printedSpareSupplier.supplierName,
                materialCode: _this.printedSpareSupplier.materialCode,
                materialName: _this.printedSpareSupplier.materialName,
                printMethod:2,
                pageIndex: _this.pageIndex4,
                pageSize: _this.pageSize4,
            };
            $.ajax({
                type:'POST',
                url:_this.metadata_service+'barCode/queryASNQuantityPage',
                cache:false,
                data:JSON.stringify(tmp),
                dataType:'JSON',
                contentType:"application/json;charset=utf-8",
                success:function(data){
                    if(data.success){
                        _this.loading4=false;
                        _this.selectDisabled=false;
                        _this.isPaging4=true;
                        _this.totalPage4=data.data.totalPage;
                        _this.totalNumber4=data.data.totalNumber;
                        _this.loadPrintSupplierData=data.data.dataList;
                    }else{
                        _this.loading4=false;
                        _this.selectDisabled=false;
                        _this.common.errorTip(data.errorMessage);
                    }
                }
            })
        },
        handleCloseSupplier(){
            this.loading4=false;
        },
        //供应商条码备件选择确定
        confirmSupplierSpare(){
            var _this=this;
            _this.printMethodSupplier=_this.selectType2?2:1;
            //加一层判断，必须选中才能确定
            if(JSON.stringify(_this.defaultLoadPrintSupplier)!="{}"){
                _this.formInlineSupplier.materialCode=_this.defaultLoadPrintSupplier.materialCode;
                _this.formInlineSupplier.materialName=_this.defaultLoadPrintSupplier.materialName;
                _this.formInlineSupplier.sourceMode=_this.defaultLoadPrintSupplier.orderType;
                _this.dialogForm2Visible=false;
            }else{
                var err = _this.languageType == "zh" ? '请选中你要选择的待打印条码备件！' : 'Please Select';
                _this.common.errorTip(err);
            }
        },
        //供应商条码生成、重新生成
        createSupplier(){
            var _this=this;
            this.spareSupplierDataAll=[];
            this.printParmSupplierData=[];
            this.snCodeList2=[];
            this.$refs['formInlineSupplier'].validate((valid) => {
                if (valid) {
                    for(var i=0;i<this.supplierSnList2.length;i++){
                        this.snCodeList2.push(this.supplierSnList2[i].spareSN);
                        this.spareSupplierDataAll.push({
                            materialCode:this.formInlineSupplier.materialCode,
                            materialName:this.formInlineSupplier.materialName,
                            SNcode:this.supplierSnList2[i].spareSN,
                            dataType:this.formInlineSupplier.dataType,
                            barCodePrintAddress:this.formInlineSupplier.regionName,
                            orignAddress:this.formInlineSupplier.sourceRegionName,
                            orignWay:this.formInlineSupplier.sourceModeName,
                            operationTime:this.formInlineSupplier.operationTime,
                            personName:this.formInlineSupplier.personName
                        });
                    }
                    _this.isPaging3=true;
                    _this.totalNumber3=_this.spareSupplierDataAll.length;
                    _this.totalPage3=Math.ceil(_this.totalNumber3/_this.pageSize3);
                    _this.pageQuerySupplier();//分页查询
                } else {
                    var err = this.languageType == "zh" ? '存在未填写的必填项！' : 'Have Empty';
                    this.common.errorTip(err);
                }
            })
        },
        //前台实现分页查询
        pageQuerySupplier(){
            var _this=this;
            _this.spareSupplierData=_this.spareSupplierDataAll.slice((_this.pageIndex3-1)*_this.pageSize3,_this.pageIndex3*_this.pageSize3);
        },
        /*供应商条码打印预览*/
        printSupplierPreview(){
            var _this=this;
            if(this.spareSupplierDataAll.length==0){
                var err = this.languageType == "zh" ? '条码列表不能为空！' : 'Have Empty';
                this.common.errorTip(err);
            }else{
                //预览
                if(this.formInlineSupplier.printMode==1 || this.formInlineSupplier.printMode==2){
                    this.printModeForSupplier=[1];
                }else if(this.formInlineSupplier.printMode==3){
                    this.printModeForSupplier=[1,2];
                }else if(this.formInlineSupplier.printMode==4){
                    this.printModeForSupplier=[1,2,3];
                }
                this.dialogSupplierPreviewVisible=true;
                this.createSupplierJsbarcode();
            }
            return false;
        },
        //打印预览需生成的条码
        createSupplierJsbarcode(){
            this.imgListSupplier=[];
            for(var i=0;i<this.snCodeList2.length;i++){
                this.jsbarcode(document.getElementById('barcodeSupplier'+i),this.snCodeList2[i],{
                    displayValue: false
                });
                var srcImg=document.getElementById('barcodeSupplier'+i).src;
                this.imgListSupplier.push(srcImg);
            }

        },
        /*供应商条码打印预览关闭*/
        handleCloseSupplierPreview(){

        },
        /*供应商条码打印*/
        printSupplierBarCode(){
            if(this.snCodeList2.length==0){
                var err = this.languageType == "zh" ? '条码列表不能为空！' : 'Have Empty';
                this.common.errorTip(err);
            }else{
                this.successPrintSupplier();
            }
            return false;
        },
        //确定打印成功时
        successPrintSupplier(){
            var _this=this;
            _this.printSupplierDisabled=true;
            var tmp={
                legalPersonCode:_this.formInlineSupplier.legalPersonCode,
                legalPersonName:_this.formInlineSupplier.legalPersonName,
                materialCode:_this.formInlineSupplier.materialCode,
                materialName:_this.formInlineSupplier.materialName,
                snCodeList:_this.snCodeList2,
                supplierSnList:_this.snCodeList2,
                createQuantity:_this.formInlineSupplier.createQuantity,
                diffCode1:_this.formInlineSupplier.diffCode1,
                diffCode2:_this.formInlineSupplier.diffCode2,
                snCodeSource:_this.formInlineSupplier.region,
//                snType:_this.formInlineSupplier.snType,
                sourceRegion:_this.formInlineSupplier.sourceRegion,
                sourceMode:_this.formInlineSupplier.sourceMode,
                asnCode: _this.defaultLoadPrintSupplier.asnCode,
                orderCode: _this.defaultLoadPrintSupplier.orderCode,
                orderType: _this.defaultLoadPrintSupplier.orderType,
                receiptNo:_this.defaultLoadPrintSupplier.receiptNo,
                supplierCode: _this.defaultLoadPrintSupplier.supplierCode,
                supplierName: _this.defaultLoadPrintSupplier.supplierName,
                printMethod:_this.printMethodSupplier
            };
            $.ajax({
                type:'POST',
                url:_this.metadata_service+'barCode/saveSNInfo',
                cache:false,
                data:JSON.stringify(tmp),
                dataType:'JSON',
                contentType:"application/json;charset=utf-8",
                success:function(data){
                    _this.printSupplierDisabled=false;
                    if(data.success){
                        _this.printSupplierFinally();
                        setTimeout(function(){
                            _this.spareSupplierData=[];
                            _this.spareSupplierDataAll=[];
                        },0)
                    }else{
                        _this.common.errorTip(data.errorMessage);
                    }
                },
                error:function(){
                    _this.printSupplierDisabled=false;
                }
            })
        },
        //调用打印ZPL
        printSupplierFinally(){
            var _this=this;
            if(_this.printSupplierIndex>=_this.snCodeList2.length){
                _this.printSupplierIndex=0;

            }else{
                this.printSupplierObj.barCode=_this.snCodeList2[_this.printSupplierIndex];
                this.printSupplierObj.lenovoFlag = _this.formInlineSupplier.lenovoFlag;//打印lenovo标记
                this.printSupplierObj.diffFlag = _this.formInlineSupplier.diffFlag;//打印区别码标记
                this.printSupplierObj.diffCon = _this.formInlineSupplier.diffCode1;//区别码内容
                //内包装     //双包装     三包装,两个外包装一个内包装
                if (_this.formInlineSupplier.printMode == "1" || _this.formInlineSupplier.printMode == "3" || _this.formInlineSupplier.printMode == "4" ) {
                    _this.printInner();
                }
                //外包装
                else if (_this.formInlineSupplier.printMode == "2") {
                    _this.printOuter();
                }
            }

        },
        //生成并打印
        createPrintSupplier(){
            var _this = this;
            this.spareSupplierDataAll=[];
            this.printParmSupplierData=[];
            this.snCodeList2=[];
            this.$refs['formInlineSupplier'].validate((valid) => {
                if (valid) {
                    for(var i=0;i<this.supplierSnList2.length;i++){
                        this.snCodeList2.push(this.supplierSnList2[i].spareSN);
                    }
                    _this.printSupplierBarCode();
                } else {
                    var err = this.languageType == "zh" ? '存在未填写的必填项！' : 'Have Empty';
                    this.common.errorTip(err);
                }
            })
        },
        /*供应商条码*/
        selectSpareSupplier(){
            this.queryByTypeSupplier();
            this.dialogForm2Visible=true;
        },
        importInSupplier(){
            if(this.formInlineSupplier.materialCode!=null && this.formInlineSupplier.materialCode!=""){
                this.importDialog2=true;
            }else{
                var err = this.languageType == "zh" ? '请先选择备件编码！' : 'Have Empty';
                this.common.errorTip(err);
            }
        },
        scanInSupplier(){
            this.scanBarCodeSupplierData=[];
            if(this.formInlineSupplier.materialCode!=null && this.formInlineSupplier.materialCode!=""){
                this.scan2Visible=true;
            }else{
                var err = this.languageType == "zh" ? '请先选择备件编码！' : 'Have Empty';
                this.common.errorTip(err);
            }
        },
        //扫描导入数据
        scanInTableSuppllier(event){
            if(event.keyCode==13){
                if(this.isHave(this.scanBarCodeSupplier,this.scanBarCodeSupplierData)){
                    if(this.scanBarCodeSupplierData.length<this.defaultLoadPrintSupplier.noProduceQuantity){
                        this.scanBarCodeSupplierData.push({spareSN:this.scanBarCodeSupplier});
                    }else {
                        var err = this.languageType == "zh" ? '扫描数量已达到上限！' : 'Have Empty';
                        this.common.errorTip(err);
                    }
                }else{
                    var err1 = this.languageType == "zh" ? '条码已存在！' : 'Have Empty';
                    this.common.errorTip(err1);
                }
            }
            this.scanBarCodeSupplier='';
        },
        confirmScanSupplier(){
            if(this.scanBarCodeSupplierData.length==0){
                var err = this.languageType == "zh" ? '扫描数量为空！' : 'Have Empty';
                this.common.errorTip(err);
            }
            this.scan2Visible=false;
            this.formInlineSupplier.createQuantity=this.scanBarCodeSupplierData.length;
            this.supplierSnList2=this.scanBarCodeSupplierData;
        },
        //文件列表移除文件时的钩子
        handleRemoveSupplier(file, fileList) {
//            console.log(file, fileList);
        },
        handlePreviewSupplier(file) {
//            console.log(file);
        },
        //上传文件之前的钩子
        beforeAvatarUploadSupplier(file) {
            // console.log(file);
            const isExcel2007 = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
            const isExcel2003 = file.type === 'application/vnd.ms-excel';
            if (!isExcel2007 && !isExcel2003) {
                this.$message.error('只能上传excel文件!');
            }
            return isExcel2007 || isExcel2003 ;
        },
        // 文件上传成功时的钩子
        handleAvatarSuccessSupplier(res, file) {
            var _this=this;
            if(res.success) {
                if(res.data.length==0){
                    var err = this.languageType == "zh" ? '导入数量为空！' : 'Empty';
                    this.common.errorTip(err);
                    _this.fileListSupplier=[];
                }else{
                    this.supplierSnList2=[];
                    this.importDialog2=false;
                    var succe = this.languageType == "zh" ? '上传成功！' : 'Successed';
                    _this.common.successTip(succe);
                    _this.fileListSupplier=[];
                    this.formInlineSupplier.createQuantity=res.data.length;
                    for(var i=0;i<res.data.length;i++){
                        this.supplierSnList2.push({spareSN:res.data[i]});
                    }
                }

            }else{
                _this.fileListSupplier=[];
                _this.common.errorTip(res.errorMessage);
            }
        },
        /*==============分页查询==================================================================================================*/
        handleSizeChange(val) {
            // console.log(`每页 ${val} 条`);
            this.pageSize=val;
            this.pageQueryLenovo();
        },
        //点击页码分页查询点击事件
        handleCurrentChange(val) {
            // console.log(`当前页: ${val}`);
            this.pageIndex=val;
            this.pageQueryLenovo();
        },
        handleSizeChange2(val) {
            // console.log(`每页 ${val} 条`);
            this.pageSize2=val;
            this.queryByType();
        },
        //点击页码分页查询点击事件
        handleCurrentChange2(val) {
            // console.log(`当前页: ${val}`);
            this.pageIndex2=val;
            this.queryByType();
        },
        handleSizeChange3(val) {
            // console.log(`每页 ${val} 条`);
            this.pageSize3=val;
            this.pageQuerySupplier();
        },
        //点击页码分页查询点击事件
        handleCurrentChange3(val) {
            // console.log(`当前页: ${val}`);
            this.pageIndex3=val;
            this.pageQuerySupplier();
        },
        handleSizeChange4(val) {
            // console.log(`每页 ${val} 条`);
            this.pageSize4=val;
            this.queryByTypeSupplier();
        },
        //点击页码分页查询点击事件
        handleCurrentChange4(val) {
            // console.log(`当前页: ${val}`);
            this.pageIndex4=val;
            this.queryByTypeSupplier();
        }
    }
  }
</script>



